// distrrtgen_cmd.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <process.h>
#include "stdafx.h"
#include "RainbowTableGenerator.h"
/*
void Thread_ListenForInput(void *pObject)
{
	CRainbowTableGenerator *pGenerator = (CRainbowTableGenerator*)pObject;
	while(1)
	{
		std::string sInput;
		std::cin >> sInput;
		if(sInput == "status")
			std::cout << pGenerator->GetCurrentCalculatedChains() << std::endl;
	}
}
*/
int main(int argc, char* argv[])
{
	CRainbowTableGenerator *pGenerator = new CRainbowTableGenerator();
//	if(Salt->IsNullOrEmpty(Salt) == false)
//		sSalt = (char*)(void*)Marshal::StringToHGlobalAnsi(Salt);

	if(argc < 10)
	{
		std::cout << "Not enough parameters";
		return -1;
	}
	std::string sFilename, sHashRoutineName, sCharsetName, sSalt;
	uint32 nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen;
	uint64 nChainStart;
	sFilename = argv[1];
	sHashRoutineName = argv[2];
	sCharsetName = argv[3];
	nPlainLenMin = atoi(argv[4]);
	nPlainLenMax = atoi(argv[5]);
	nRainbowTableIndex = atoi(argv[6]);
	nRainbowChainLen = atoi(argv[7]);
	nRainbowChainCount = atoi(argv[8]);
	nChainStart = _atoi64(argv[9]);
	if(argc == 11)
	{
		sSalt = argv[10];
	}
	//std::cout << "Starting ChainGenerator" << std::endl;
	return pGenerator->CalculateTable(sFilename, nRainbowChainCount, sHashRoutineName, sCharsetName, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen, nChainStart, sSalt);
}

